﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RealtyManagementSystem.BLL;

namespace RealtyManagementSystem.Web.RealtyManagers
{
    public partial class AnnouncementPreview : System.Web.UI.Page
    {
        private string announceId = string.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
            announceId = this.Request.QueryString["announceId"];

            if (!IsPostBack)
            {
                BindContent();
            }
        }

        private void BindContent()
        {
            var aId = Convert.ToInt32(announceId);
            var announce = new AnnouncementsProvider().GetById(aId);
            this.lblTitle.Text = announce.Title;
            this.lblContent.Text = announce.Content;
            this.lblAuthor.Text = announce.aspnet_Users.UserName;
            this.lblCreateDate.Text = announce.CreateDate.ToLongDateString() + " \t"
                + announce.CreateDate.ToShortTimeString();
        }
    }
}